<?php
header("content-type:text/html;charset=utf8");
$pdo = new PDO("mysql:host=127.0.0.1;dbname=1114;charset=utf8",'root','root');
$redis = new Redis();
$redis ->connect("127.0.0.1","6379");
$city = $_POST['city'];
//print_r($city);die;
$url = "http://api.k780.com:88/?app=weather.future&weaid=$city&&appkey=10003&sign=b59bc3ef6191eb9f747dd4e83c99f2a4&format=json";
$data = file_get_contents($url);
$data = json_decode($data,true);
//print_r($data);die;
$result = $data['result'];
echo json_encode($result);
//foreach ($result as $k => $v)
//{
//    $city = $v['citynm'];
//    $week = $v['week'];
//    $temp_high = $v['temp_high'];
//    $temp_low = $v['temp_low'];
//    $temperature = $v['temperature'];
//    $sql = "insert into wea values ('','$city','$week','$temp_high','$temp_low','$temperature')";
//    $res = $pdo->exec($sql);
//}
//if ($res)
//{
//    $data = array('code'=>1,'msg'=>"成功");
//}else{
//    $data = array('code'=>1,'msg'=>"失败");
//}
//echo json_encode($data);
?>